@echo off

::项目名称
set ProjectName=OfficeReadWrite_QT

::构建路径
set Make=..\Make\

::以下的目录的相对路径都是相对于Make目录而言

::项目路径
set ProjectDirPath=..\OfficeReadWrite_QT\

::脚本文件目录
set CreateMake=..\CreateMake

::bin目录路径
set BinDirPath=%ProjectDirPath%bin\

::依赖库路径 depends
set DependsDir=%ProjectDirPath%%ProjectName%\depends\

::Qt版本号
set Qt5_13_2=C:\Qt\Qt5.13.2\
set Qt5_12_3=D:\Qt\Qt5.12.3\
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::以下的代码无须改动，只需改动上边的定义即可:::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
if EXIST %Qt5_12_3% (
	set VersionNumber=5.12.3
	set QtPath=%Qt5_12_3%
) else if EXIST %Qt5_13_2% (
	set VersionNumber=5.13.2
	set QtPath=%Qt5_13_2%
) 
::为Qt使用设置环境…
echo Setting up environment for Qt usage...
set PATH=%QtPath%\%VersionNumber%\mingw73_64\bin;%QtPath%/Tools/mingw730_64\bin;%PATH%

if not EXIST %Make% (
	mkdir  %Make%
)
cd  %Make%


mingw32-make.exe clean
qmake.exe %ProjectDirPath%%ProjectName%\%ProjectName%.pro -spec win32-g++ "CONFIG+=release" && mingw32-make.exe qmake_all
mingw32-make.exe -j4

if not EXIST %BinDirPath% (
	mkdir %BinDirPath%
)

::将可执行exe文件拷贝至bin目录下
copy .\release\%ProjectName%.exe %BinDirPath%

windeployqt %BinDirPath%%ProjectName%.exe

::拷贝依赖库dll到bin目录下
start /wait "call get_releaseFiles.bat" cmd /c call %DependsDir%get_releaseFiles.bat
xcopy %DependsDir%release\*.* %BinDirPath% /s /e /c /y /h /r

::"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" %CreateMake%\makeAll.iss

pause
